package com.workerhelping.exception;

import com.workerhelping.result.ResultCodeEnum;
import lombok.Data;
import lombok.ToString;

@SuppressWarnings("all")
@Data
public class CommonException extends RuntimeException {

    // 异常状态码
    private Integer code;

    // 构造创建
    public CommonException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    // 枚举创建
    public CommonException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
